CC=gcc
CFLAGS=-Wall

DEBUG=y
ifeq ($(DEBUG),y)
CFLAGS+=-g
else
CFLAGS += -O2
endif

SRCS:=$(notdir $(shell find *.c))
TARGETS:=$(patsubst %.c,$(BINDIR)/%.out,$(notdir $(SRCS)))

.PHONY:all clean

all:$(TARGETS)
	echo Targets: $^
	
$(BINDIR)/%.out:%.c
	@-rm -rf $@
	$(CC) $(CFLAGS) $^ $(INCFLAG) -o $@ $(LDFLAGS)
	
clean:
	@-rm -rf *.out
	@-rm -rf *.orig
